~ chicken-core (master) /manual/Egg specification format


  1[[tags: manual]]
  2[[toc:]]
  3
  4
  5== Format of the egg description file
  6
  7An egg description is basically an association list holding
  8information about the components of the egg. An egg may contain
  9multiple components: libraries, programs, Scheme or C include files
 10and arbitrary data files. Dependencies between eggs can be
 11specified as can be dependencies between components of an egg.
 12
 13A list of valid properties follows.
 14
 15=== Global properties
 16
 17==== version
 18
 19 [egg property] (version STRING)
 20
 21Specifies version string for this egg. {{STRING}} should have
 22the format {{<MAJOR>.<MINOR>.<PATCHLEVEL>}}, where only the
 23{{<MAJOR>}} part is mandatory.
 24
 25Eggs from remote egg servers are automatically versioned - the
 26version is part of the protocol to retrieve the egg and does not
 27have to be specified in the {{.egg}} file. Eggs installed from
 28local directories (see below) should explicitly specify a version.
 29
 30==== synopsis
 31
 32 [egg property] (synopsis STRING)
 33
 34Gives a short description of this egg.
 35
 36==== author
 37
 38 [egg property] (author STRING)
 39
 40Names the author or authors of the contained code.
 41
 42==== maintainer
 43
 44 [egg property] (maintainer STRING)
 45
 46Names the maintainer of this code, if different from author(s).
 47
 48==== category
 49
 50 [egg property] (category NAME)
 51
 52Gives the category under which this egg should be contained.
 53See [[https://wiki.call-cc.org/chicken-projects/egg-index-5.html|the egg index]]
 54for a list of currently used categories.
 55
 56==== license
 57
 58 [egg property] (license STRING)
 59
 60Names the license under which this code is available.
 61
 62==== dependencies
 63
 64 [egg property] (dependencies EGG ...)
 65
 66Lists eggs that this egg depends on, and which should be
 67built and installed if they do not already exist in the repository.
 68{{EGG}} should be whether a symbol or a list of the form
 69{{EGGNAME VERSION}}, where the former means to install the
 70newest available egg with this name and the latter specifies
 71a specific version or higher. {{EGGNAME}} may also be the string or
 72symbol {{chicken}}, in case you want your extension to depend
 73on a minimum required CHICKEN of {{VERSION}} or newer.
 74
 75This property can also be used to specify a minimum version of CHICKEN
 76required by the egg.  For example, to require at least CHICKEN 6.0.0:
 77
 78<enscript highlight=scheme>
 79(dependencies (chicken "6.0.0"))
 80</enscript>
 81
 82==== test-dependencies
 83
 84 [egg property] (test-dependencies EGG ...)
 85
 86Lists eggs that are required for this egg to run the tests
 87(if tests exist.) This only has an effect if the {{-test}}
 88option has been given to {{chicken-install}}.
 89
 90==== build-dependencies
 91
 92 [egg property] (build-dependencies EGG ...)
 93
 94Lists eggs that are build-time dependencies for this egg,
 95i.e. there are required to build, but not to run the contained
 96code. Currently this is treated identical to {{dependencies}}.
 97
 98==== foreign-dependencies
 99
100 [egg property] (foreign-dependencies NAME ...)
101
102Lists external dependencies like native code libraries
103or system-specific packages and is currently only used for
104documentation purposes.
105
106==== platform
107
108 [egg property] (platform PLATFORM)
109
110Specifies for which platform this egg is intended. {{PLATFORM}}
111should be a symbol naming the target platform ({{windows}}, {{linux}}
112or {{unix}}) or a boolean combination of platform values, allowed
113are {{(not PLATFORM)}}, {{(or PLATFORM ...)}} and {{(and PLATFORM ...)}}.
114If the expression can not be satisfied, then installation of this
115egg will abort.
116
117==== distribution-files
118
119 [egg property] (distribution-files FILE ...)
120
121List of files required for the installation of the egg.  This
122form is not handled by chicken-install, but by henrietta-cache to
123determine what to cache. If the repository contains additional
124files that are unneeded for the egg to be installed, you can list
125all the required files in this clause to reduce the amount of data
126cached by egg servers.
127
128==== components
129
130 [egg property] (components COMPONENT ...)
131
132Lists components (extensions, programs, include- or data files) that
133this extension installs. See [[#component-types|Component types]] and
134[[#component-properties|component properties]] for information on how
135to specify component-specific information.
136
137==== host
138
139 [egg property] (host PROP ...)
140
141Recursively process {{PROP ...}}, but only for the host (build)
142platform, in case this is a "cross-chicken", a CHICKEN installation
143intended for cross compilation.
144
145==== target
146
147 [egg property] (target PROP ...)
148
149Recursively process {{PROP ...}}, but only for the target
150platform, in case this is a "cross-chicken", a CHICKEN installation
151intended for cross compilation.
152
153==== component-options
154
155 [egg property] (component-options OPTIONSPEC ...)
156
157Specifies global options for all programs and extensions compiled for this egg.
158{{OPTIONSPEC}} may be {{csc-options}}, {{link-options}} or {{linkage}} specifications.
159
160==== cond-expand
161
162 [egg property] (cond-expand CLAUSE ...)
163
164Conditionally expand egg specification forms, depending on system
165features. Each {{CLAUSE}} should be of the form
166{{(TEST PROPERTY)}} where {{TEST}} is a feature identifier or a
167conditional form, in the same syntax as used in the {{cond-expand}}
168syntactic form.
169
170In addition to normal system-wide feature identifiers, feature identifiers
171given via the {{-feature}} option to {{chicken-install}} are visible in
172the tests. Also, the features {{target}}, {{host}}, {{dynamic}} and
173{{static}} are visible, depending on surrounding egg specification
174forms for constraining mode and linkage.
175
176==== error
177
178 [egg property] (error STRING ARG ...)
179
180Signal an error and abort processing. Mostly useful inside {{cond-expand}} forms.
181
182==== custom-build
183
184 [egg property] (custom-build STRING)
185
186Specifies a custom build script to be invoked for all components of the egg,
187ignoring all component-specific instructions and properties. {{STRING}} should be the
188name of a {{sh(1)}} shell script and thus may be platform
189sensitive.  The path to the file is prepended implicitly, so you
190should '''not''' prefix it with {{./}}.
191
192The script is executed with the location of the CHICKEN
193binaries in the {{PATH}}. Also, the following environment variables
194are set in the execution environment of the script:
195
196* {{CHICKEN_CC}}: name of the C compiler used for building CHICKEN
197* {{CHICKEN_CXX}}: name of the C++ compiler set during the build of CHICKEN
198* {{CHICKEN_CSC}}: path to {{csc}}
199* {{CHICKEN_CSI}}: path to {{csi}}
200
201=== Component types
202
203==== extension
204
205 [egg property] (extension NAME PROP ...)
206
207Specifies an extension library component. The properties
208{{PROP...}} are processed recursively and apply only to this
209component.
210
211==== data
212
213 [egg property] (data NAME PROP ...)
214
215Specifies one or more arbitrary data files.
216
217==== generated-source-file
218
219 [egg property] (generated-source-file NAME PROP ...)
220
221Specifies a file that is generated during the process of building
222the egg.
223
224==== c-include
225
226 [egg property] (c-include NAME PROP ...)
227
228Specifies one or more C include files.
229
230==== scheme-include
231
232 [egg property] (scheme-include NAME PROP ...)
233
234Specifies one or more Scheme include files.
235
236==== program
237
238 [egg property] (program NAME PROP ...)
239
240Specifies an executable program.
241
242==== c-object
243
244 [egg property] (c-object NAME PROP ...)
245
246Specifies a compiled C/C++ object file. Usually this component type
247is required if you want to link a separately compiled C/C++ module
248with your extension or program. C-objects are compiled like Scheme
249source files with the {{csc}} tool to ensure the same C compiler
250options and toolchain is used as for regular Scheme files compiled
251to C. If you want to pass compiler-specific options to the build
252of the C object, use the {{csc-options}} property and precede
253C compiler options with {{-C}}.
254
255Components of this type are never installed, they just exist at build time.
256
257==== installed-c-object
258
259  [egg property] (installed-c-object NAME PROP ...)
260
261Similar to {{c-object}}, but the compiled object file will be installed in the
262extension repository.
263
264=== Component properties
265
266==== host
267
268 [egg property] (host PROP ...)
269
270Process {{PROP ...}} recursively for the current component, but
271apply the properties only to the host (build) part, when using
272a CHICKEN installation intended for cross-compilation.
273
274==== target
275
276 [egg property] (target PROP ...)
277
278Process {{PROP ...}} recursively for the current component, but
279apply the properties only to the target part, when using
280a CHICKEN installation intended for cross-compilation.
281
282==== linkage
283
284 [egg property] (linkage LINKAGE)
285
286Define whether the component should be linked dynamically or
287statically. {{LINKAGE}} can be {{static}} or {{dynamic}}. This
288property only makes sense for extension libraries.
289
290==== types-file
291
292 [egg property] (types-file [NAME])
293
294Specifies that a "type-database" file should be generated and
295installed for this component. This property is only used for
296extension libraries. The name is optional and defaults to the
297name of the extensions (with the proper extension).
298
299If {{NAME}} is a list of the form {{(predefined [NAME])}}, then
300no types file is created during compilation and an existing types file
301for this extension is assumed and installed.
302
303==== inline-file
304
305 [egg property] (inline-file [NAME])
306
307Specifies that an "inline" file should be generated and installed
308for this component. This property is only used for extension
309libraries. The name is optional and defaults to the
310name of the extensions (with the proper extension).
311
312==== custom-build
313
314 [egg property] (custom-build STRING)
315
316Specifies a custom build script that should be executed instead of
317the default build operations for this component. This property is mandatory for
318components of type {{generated-source-file}}. 
319{{STRING}} should be the
320name of a {{sh(1)}} shell script and thus may be platform
321sensitive.  The path to the file is prepended implicitly, so you
322should '''not''' prefix it with {{./}}.
323
324The script will be invoked like the {{csc}} program and
325is executed with the location of the CHICKEN
326binaries in the {{PATH}}. Environment variables are set up as
327for the global {{custom-build}} property, as described above.
328
329==== csc-options
330
331 [egg property] (csc-options OPTION ...)
332
333Specifies additional compiler options for {{csc}} that should be
334used when building this component. If this property is not
335given, the default options are used, which are {{-O2 -d1}}
336for extensions and programs and {{-O2 -d0}} for import
337libraries.
338
339Note that the options are quoted when passed to csc during the
340compilation of the extension, so multiple options should be specified
341as {{(csc-options "OPT1" "OPT2" ...)}} instead of {{(csc-options "OPT1 OPT2")}}
342(the latter would be a single option containing a whitespace character).
343
344OPTION may optionally be a list of the form {{(custom-config FILENAME ARG ...)}},
345which allows to dynamically determine options to be passed to the {{csc}}
346program. FILENAME should be the name of a Scheme source file in the
347current build directory. The file is invoked as {{csi -s FILENAME ARG ...}}
348and should write s-expressions to stdout that are taken as additional
349options to be passed to {{csc}} when compiling a component. The expressions
350are read in, any list structure is flattened and all items are converted to
351strings and added to the list of compilation options.
352
353==== link-options
354
355 [egg property] (link-options OPTION ...)
356
357Specifies additional link options for {{csc}} that should be
358used when building this component.
359
360Note that the options are quoted when passed to csc during the
361compilation of the extension, so multiple options should be specified
362as {{(link-options "OPT1" "OPT2" ...)}} instead of {{(link-options "OPT1 OPT2")}}
363(the latter would be a single option containing a whitespace character).
364
365Note that in order to pass linker options to the underlying C-compiler, these must
366be prefixed with {{-L}}, eg. {{(link-options "-L" "-lpng")}}.
367
368This property supports {{custom-config}} specifications, described above.
369
370==== source
371
372 [egg property] (source NAME)
373
374Specifies an alternative source file, in case it has a name
375distinct from the component name. By default the source file
376for a component is named after the component, with the {{.scm}}
377extension added.
378
379==== install-name
380
381 [egg property] (install-name NAME)
382
383Specifies an alternative installation name of the component,
384if it differs from the actual component name. This property
385is most useful if an egg installs an extension and a program
386of the same name, but needs to distinguish the components during
387build time.
388
389==== component-dependencies
390
391 [egg property] (component-dependencies NAME ...)
392
393Specifies dependencies to other components. {{NAME ...}} must
394be the names of extension, program, scheme-include- or generated source file
395components that should be built before the current component.
396
397==== source-dependencies
398
399 [egg property] (source-dependencies NAME ...)
400
401Specifies dependencies to additional source files. {{NAME ...}} must
402denote filenames of which the program or extension depends.
403A program or extension implicitly depends on its source file and
404and on the egg-specification file.
405
406==== objects
407
408 [egg property] (objects NAME ...)
409
410Specifies that the components of type {{c-object}} should be linked
411to this component and that the object components are dependencies.
412
413
414==== destination
415
416 [egg property] (destination NAME)
417
418Specifies an alternative installation destination for the
419built component and only applies
420to components of type {{data}}, {{c-include}} and {{scheme-include}}.
421This property should only be used in extreme
422cases, as it is recommended to use the default installation
423locations, which are:
424
425* for C include files: {{<PREFIX>/include/chicken/}}
426
427* for Scheme include files: {{<PREFIX>/share/chicken/}}
428
429* for data files: {{<PREFIX>/share/chicken/}}
430
431==== files
432
433 [egg property] (files NAME ...)
434
435Specifies source files for this component and only applies
436to components of type {{data}}, {{c-include}} and {{scheme-include}}.
437Both files and directories may be given and parent directories
438are created as needed.
439
440==== modules
441
442 [egg property] (modules NAME ...)
443
444Specifies modules that the component (usually an extension) contains.
445{{chicken-install}} will compile and install all import libraries for the given modules.
446If this property is not given, then it is assumed that the extension has a single
447module of the same name as the component.
448
449==== cond-expand
450
451 [egg property] (cond-expand CLAUSE ...)
452
453Similar to the toplevel {{cond-expand}} clause and may appear inside
454component specifications.
455
456==== error
457
458 [egg property] (error STRING ARG ...)
459
460Similar to the toplevel {{error}} form, may appear inside component specifications.
461
462---
463
464Previous: [[Extension tools]]
465
466Next: [[Units and linking model]]
Trap